import request from "@/utils/request";

// 查询课程列表
export function listJuanCourse(query) {
  return request({
    url: "/system/juanCourse/list",
    method: "get",
    params: query,
  });
}

// 查询课程详细
export function getJuanCourse(courseId) {
  return request({
    url: "/system/juanCourse/" + courseId,
    method: "get",
  });
}

// 获取编码
export function getJuanCourseCode(query) {
  return request({
    url: "/system/juanCourse/check",
    method: "get",
    params:query
  });
}
// 新增课程
export function addJuanCourse(data) {
  return request({
    url: "/system/juanCourse",
    method: "post",
    data: data,
  });
}

// 修改课程
export function updateJuanCourse(data) {
  return request({
    url: "/system/juanCourse",
    method: "put",
    data: data,
  });
}

// 删除课程
export function delJuanCourse(courseId) {
  return request({
    url: "/system/juanCourse/" + courseId,
    method: "delete",
  });
}


// 查询课程已绑定用户列表
export function allocatedUserList(query) {
  return request({
    url: "/system/juanCourse/bindUser/allocatedList",
    method: "get",
    params: query,
  });
}

// 查询课程未绑定用户列表
export function unallocatedUserList(query) {
  return request({
    url: "/system/juanCourse/bindUser/unallocatedList",
    method: "get",
    params: query,
  });
}

// 批量取消用户授权角色
export function bindUserCancelAll(data) {
  return request({
    url: "/system/juanCourse/bindUser/cancelAll",
    method: "put",
    params: data,
  });
}

// 授权用户选择
export function bindUserSelectAll(data) {
  return request({
    url: "/system/juanCourse/bindUser/selectAll",
    method: "put",
    params: data,
  });
}

// 根据专业id查询课程列表
export function getCourseByMajorId(query) {
  return request({
    url: "/system/juanCourse/getCourseByMajorId",
    method: "get",
    params: query,
  });
}

// 查询左侧树结构
export function leftTree() {
  return request({
    url: "/system/juanCourse/getMajorTree",
    method: "get",
  });
}

// 查询左侧树结构
export function courseTreeList() {
  return request({
    url: "/system/juanCourse/getTreeAndCourse",
    method: "get",
  });
}

// 合并题库
export function mergeCourse(data) {
  return request({
    url: "/system/juanCourse/mergeCourse",
    method: "post",
    data
  });
}
